package cn.xiyun.xiyuncc.web.controller;

import cn.xiyun.xiyuncc.dto.AlipayNotifyDto;
import cn.xiyun.xiyuncc.result.JSONResult;
import cn.xiyun.xiyuncc.service.IPayResultProcessingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/payResult")
public class PayResultProcessingController {

    @Autowired
    private IPayResultProcessingService payResultProcessingService;
    /**
     * 支付同步回调
     */
    @RequestMapping(value = "/paySynCallback")
    public String paySynCallback() {
        System.out.println("支付同步回调");
        return "redirect:http://127.0.0.1:6002/pay.success.html";
    }

    /**
     * 支付异步回调
     */
    @RequestMapping(value = "/payNotifyCallback")
    @ResponseBody
    public String payNotifyCallback(AlipayNotifyDto alipayNotifyDto) throws Exception{

        return payResultProcessingService.payNotifyCallback(alipayNotifyDto);
    }


}
